{extend name='public/base' /}


{block name="content"}
<style type="text/css">
    .tittle {
        text-align: center;
        margin: 20px 0;
        font-size: 24px;
    }

    .box {
        width: 130px !important;
    }

    .auto {
        margin-left: 160px !important;
    }
</style>
<div class="layui-col-md12">

    <div class="layui-card">
        <form class="layui-form" action="" lay-filter="form">
            <div class="layui-card-body">

                <div class="layui-card-body">
                    <input type="hidden"   name="id" value="{$info.id}" id="id" class="layui-input ">
                    <div class="layui-form" lay-filter="">

                        <div class="tittle">催 缴 配 置</div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">提前几天催缴</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="number" name="date_time" value="{$info.date_time}" id="date_time"
                                       data-minvalue="1"
                                       lay-verify="required" placeholder="提前几天催缴"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <hr>
                        <div class="tittle">发 票 配 置</div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票地址</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="invoice_url" value="{$info.invoice_url}" id="invoice_url"
                                       placeholder="开票地址"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票appid</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="invoice_account" value="{$info.invoice_account}" id="invoice_account"
                                       placeholder="开票appid"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票秘钥</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="invoice_password" value="{$info.invoice_password}" id="invoice_password"
                                       placeholder="开票秘钥"
                                       class="layui-input layui-form-danger">
                            </div>

                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票公司主体</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="company" value="{$info.company}" id="company"
                                       placeholder="开票公司主体"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票公司税号</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="tax" value="{$info.tax}" id="tax"
                                       placeholder="tax"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票公司地址</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="adress" value="{$info.adress}" id="adress"
                                       placeholder="开票公司地址"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票公司电话</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="mobile" value="{$info.mobile}" id="mobile"
                                       placeholder="开票公司电话"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">开票人</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="people" value="{$info.people}" id="people"
                                       placeholder="开票人"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">复核人</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="FHR" value="{$info.FHR}" id="FHR"
                                       placeholder="复核人"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">收款人</label>
                            <div class="layui-input-inline" style="width: 700px">
                                <input type="text" name="SKR" value="{$info.SKR}" id="SKR"
                                       placeholder="收款人"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">银行账号</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="bank_account" value="{$info.bank_account}"
                                       id="bank_account"
                                       placeholder="银行账号"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">发票剩余次数</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="invoicesum" value="{$info.invoicesum}"
                                       id="invoicesum"
                                       placeholder="发票剩余次数"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">物业开票次数</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" disabled  value="{$info.wuye}"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">停车开票次数</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" disabled  value="{$info.tingche}"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <hr>
                        <div class="tittle">金 蝶 配 置</div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">金蝶账号</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="jindie_account" value="{$info.jindie_account}"
                                       id="jindie_account"
                                       placeholder="金蝶账号"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">金蝶密码</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="jindie_password" value="{$info.jindie_password}"
                                       id="jindie_password"
                                       placeholder="金蝶密码"
                                       class="layui-input layui-form-danger">
                            </div>
                        </div>
                        <hr>
                        <div class="tittle">银 行 配 置</div>
                        <div class="layui-form-item">
                            <label class="layui-form-label box">银行账号及地址</label>
                            <div class="layui-input-inline" style="width: 400px">
                                <input type="text" name="back_number[]" value="{$info.back_number[0]}"
                                       placeholder="银行账号及地址"
                                       class="layui-input layui-form-danger">
                                <input style="margin-top: 10px" type="text" name="back_number[]" value="{$info.back_number[1]}"
                                       placeholder="银行账号及地址"
                                       class="layui-input layui-form-danger">
                                <input style="margin-top: 10px" type="text" name="back_number[]" value="{$info.back_number[2]}"
                                       placeholder="银行账号及地址"
                                       class="layui-input layui-form-danger">
                            </div>

                        </div>
                    </div>
                    <hr>
                    <div class="tittle">收 据 配 置</div>
                    <div class="layui-form-item">
                        <label class="layui-form-label box">收据公司名称</label>
                        <div class="layui-input-inline" style="width: 400px">
                            <input type="text" name="receipt_company" value="{$info.receipt_company}"
                                   id="receipt_company"
                                   placeholder="收据公司名称"
                                   class="layui-input layui-form-danger">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label box">收据底部展示</label>
                        <div class="layui-input-inline" style="width: 400px">
                            <input type="text" name="receipt_title" value="{$info.receipt_title}"
                                   id="receipt_title"
                                   placeholder="收据底部展示"
                                   class="layui-input layui-form-danger">
                        </div>
                    </div>
                    {if empty($info['image'])}
                    <div class="layui-form-item merch">
                        <label class="layui-form-label"> 收据章子  *</label>
                        <div style="width: 500px;height: 280px;display: inline-block; text-align: center;"
                             id="image"><span
                                style="line-height: 280px;color: #ccc;font-size: 12px;">+点击添加图片</span>
                        </div>
                    </div>
                    {else/}
                    <div class="layui-form-item merch">
                        <label class="layui-form-label">收据章子 *</label>
                        <div style="width: 500px;height: 280px;display: inline-block; text-align: center;"
                             id="image"><img id="img1"  src="{$info.image}" style="width: 100%; height: 100%;" >
                        </div>
                    </div>
                    {/if}
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit="" lay-filter="setmypass">确认修改</button>
                        </div>
                    </div>

                </div>
            </div>
        </form>
    </div>

</div>


{/block}

{block name="js"}
<!--js处理区-->

<script>

    layui.use(['element', 'form', 'jquery', 'lucky','upload'], function () {
        var element = layui.element;
        var form = layui.form;
        var $ = layui.jquery;
        var lucky = layui.lucky;
        var upload = layui.upload;
        form.render();
        /**
         *上传封面照片
         */
        upload.render({
            elem: '#image',
            url: "{:url('common/UpNoticeImg')}" //图片上传地址
            ,
            accept: 'images' //
            ,
            acceptMime: 'image/*',
            size: 1024 * 12,
            before: function(res) {
                loading = layer.load(2, {
                    shade: [0.2, '#000'] //0.2透明度的白色背景
                });
            },
            done: function(data) {
                console.log(data)
                var image1 = document.getElementById('image')
                image1.innerHTML = ` <img id="img1" src="" style="width: 100%; height: 100%;" >`
                layer.close(loading);
                if (data.code == 1) {
                    console.log(data)
                    $("#img1").attr("src", data.data.thumb_path);
                    layer.msg('图片上传成功', {
                        icon: 1,
                        time: 1000
                    });
                } else {
                    layer.msg(data.msg, {
                        icon: 5,
                        time: 1000
                    });
                }
            },
            error: function(red) {
                layer.close(loading);
                layer.msg("网络错误", {
                    icon: 5,
                    time: 1500
                });
            }
        });

        /**
         * 表格{:__('Submit')}
         */
        form.on('submit(setmypass)', function (data) {
            console.log(data);
            var image = $("#img1").attr("src");
            data.field.image = image
            lucky.FormSubmit("{:url('saveconfig')}", data.field);
            return false;
        });
    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#send_time', //指定元素
            format: 'yyyy-MM-dd HH:mm:ss',
            type: 'datetime'
        });
    });

</script>


{/block}